/*********************************************************************/
/*  文件名  HttpConstant.java    　                                 	 */
/*  程序名  Http常量                     						     	*/
/*  版本履历   2018/8/5  修改                  黄维    			    */
/*         Copyright 2018 ZL. All Rights Reserved.                  */
/*********************************************************************/
package com.zhaolang.qogir.util;

import java.text.SimpleDateFormat;
import java.util.Date;

public final class HttpConstant {

    public static String TOKEN = null;
    public static final boolean DEBUG_VERSION = ReleaseUtils.DEBUG_REMOTE_MODE;

    // for local debug
    public static final String DEBUG_USER_HOST_IP = "https://jjwteam.xyz/FHADMINS/";

//    public static final String DEBUG_USER_HOST_IP = "http://192.168.1.2:8080/FHADMINS/";

    /* normal server address */
    private static final String RELEASE_USER_HOST_IP = "https://101.132.36.160/FHADMINS/";

    private static final String DEBUG_RADAR_HOST_IP = "https://101.132.36.160:8083/FHADMINS/";

    private static final String RELEASE_RADAR_HOST_IP = "http://121.41.79.23:80/";

    private static final String DEBUG_FTP_IP = "http://114.215.181.127:8083/";
    private static final String RELEASE_FTP_IP = "http://114.215.181.127:8083/";
    // user系统测试环境
    private static final String TEST_USER_HOST_IP = "http://10.4.64.247:8081/";
    // radar系统测试环境
    private static final String TEST_RADAR_HOST_IP = "http://10.4.64.248:9091/";
    // 亚莉环境ip
    private static final String YL_HOST_IP = "http://10.4.64.119:8080/";
    // 正式环境
    public static final String OFFICIAL_USER_HOST_IP = DEBUG_VERSION ? DEBUG_USER_HOST_IP
            : RELEASE_USER_HOST_IP;
    // radar系统正式环境
    public static final String OFFICIAL_RADAR_HOST_IP = DEBUG_VERSION ? DEBUG_RADAR_HOST_IP
            : RELEASE_RADAR_HOST_IP;// "http://121.41.79.23:9091/";
    // radar正式环境下载图片地址
    public static final String OFFICIAL_RADAR_DOWNLOAD_IMG_IP = OFFICIAL_RADAR_HOST_IP + "uploadFiles/uploadImgs/";
    // ftp下载版本环境
    public static final String FTP_GET_VER_IP = DEBUG_VERSION ? DEBUG_FTP_IP : RELEASE_FTP_IP;
    // 进一步了解radar链接
    public static final String GET_RADAR_INFO_MORE = RELEASE_RADAR_HOST_IP + "radar";
    public static final String URL_BASE = "appuser/";
    public static final String WEIXIN_BASE = "weixin/";
    // user注册接口
    private static final String USER_REG = URL_BASE + "registerUser.do";
    // user登录接口
    private static final String USER_LOGIN = URL_BASE + "userLogin.do";
    // 插入多条测试数据接口
    private final static String QUERY_CHART_DATA = "radar/analyze/queryChartData";
    //更新商家商品信息
    private final static String UPLOAD_WARES_INFO = URL_BASE + "writeWaresInfo";
    // 上传话题信息
    private final static String CREATE_TOPIC = "radar/createTopic";
    // 更新所有本地帖子发送状态
    public final static String POST_RELEASE_UPDATE_STATE_ALL = "post_release_update_state_all.action";
    // 插入本地user
    private final static String UPLOAD_PORTRAIN = URL_BASE + "uploadPortrait.do";
    // 上传用户头像
    private final static String UPLOAD_THUMBNAIL = URL_BASE + "uploadThumbnail";
    // 更新porduct class
    private final static String WRITE_SHOP_CLASS = URL_BASE + "writeShopClass";
    // list all product class
    private final static String GET_SHOP_CLASS = URL_BASE + "getShopClass";
    // list all product class
    private final static String WRITE_SHOP_PRODUCT = URL_BASE + "writeShopProduct";
    // list all product
    private final static String READ_ALL_PRODUCT = URL_BASE + "getAllProduct";
    // read unique product
    private final static String READ_UNIQUE_PRODUCT = URL_BASE + "readProduct";
    // read all order
    private final static String READ_ALL_ORDER = WEIXIN_BASE + "overallOrder";
    // get all finished order list
    private final static String GET_ALL_FINISHED_ORDER = WEIXIN_BASE + "getShopFinishedOrderList";
    // obtain an new order
    private final static String GET_FINISHED_ORDER = WEIXIN_BASE + "obtainCompleteOrder";
    // request shop status
    private final static String REQUEST_SHOP_STATUS = WEIXIN_BASE + "requestShop";
    // update shop status
    private final static String UPDATE_SHOP_STATUS = WEIXIN_BASE + "updateShopStatus";
    // update product carriage
    private final static String UPDATE_PRODUCT_CARRAIGE = WEIXIN_BASE + "carriageProduct";
    /**
     * user注册url
     */
    public static String getRegUrl(String json) {
        return OFFICIAL_USER_HOST_IP + USER_REG;
    }

    /**
     * user登录url
     */
    public static String getLoginUrl(String json) {
        return OFFICIAL_USER_HOST_IP + USER_LOGIN;
    }

    /**
     * 上传商品具体信息
     */
    public static String writeWaresInfo(String json) {
        return OFFICIAL_USER_HOST_IP + UPLOAD_WARES_INFO;
    }

    /**
     * 上传用户头像url
     */
    public static String uploadPortrait(String json) {
        return OFFICIAL_USER_HOST_IP + UPLOAD_PORTRAIN;
    }

    /**
     * 上传商品thumbnail url
     */
    public static String uploadThumbanil(String json) {
        return OFFICIAL_USER_HOST_IP + UPLOAD_THUMBNAIL;
    }

    public static String writeShopClass(String json){
        return OFFICIAL_USER_HOST_IP + WRITE_SHOP_CLASS;
    }

    public static String getShopClass(String json){
        return OFFICIAL_USER_HOST_IP + GET_SHOP_CLASS;
    }

    public static String getWriteShopClass(String json){
        return OFFICIAL_USER_HOST_IP + WRITE_SHOP_PRODUCT;
    }

    public static String getAllProduct(String json){
        return OFFICIAL_USER_HOST_IP + READ_ALL_PRODUCT;
    }

    public static String readProduct(String json){
        return OFFICIAL_USER_HOST_IP + READ_UNIQUE_PRODUCT;
    }

    public static String readAllOrder(String json){
        return OFFICIAL_USER_HOST_IP + READ_ALL_ORDER;
    }

    public static String getAllFinishedOrder(String json){
        return OFFICIAL_USER_HOST_IP + GET_ALL_FINISHED_ORDER;
    }

    public static String obtainFinishedOrder(String json){
        return OFFICIAL_USER_HOST_IP + GET_FINISHED_ORDER;
    }

    public static String getShopStatus(String json){
        return OFFICIAL_USER_HOST_IP + REQUEST_SHOP_STATUS;
    }

    public static String setShopStatus(String json){
        return OFFICIAL_USER_HOST_IP + UPDATE_SHOP_STATUS;
    }

    public static String setProductCarriage(String json){
        return OFFICIAL_USER_HOST_IP + UPDATE_PRODUCT_CARRAIGE;
    }

    /*
     * 所有请求都必须加上FKEY
     */
    public static String getFKEY() {
        SimpleDateFormat sdfDays = new SimpleDateFormat("yyyyMMdd");
        String strDays = sdfDays.format(new Date());
        return MD5.getMD5("USERNAME" + strDays + ",fh,");
    }
}
